package simple.framework.util;

import java.util.regex.*;

public class validator
{
  public static Boolean isChinese(String argString)
  {
    Boolean tbool = false;
    String tString = argString;
    if (!cls.isEmpty(tString))
    {
      Pattern tPattern = Pattern.compile("^[\\u0391-\\uFFE5]+$");
      Matcher tMatcher = tPattern.matcher(tString);
      tbool = tMatcher.matches();
    }
    return tbool;
  }

  public static Boolean isEmail(String argString)
  {
    Boolean tbool = false;
    String tString = argString;
    if (!cls.isEmpty(tString))
    {
      Pattern tPattern = Pattern.compile("^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
      Matcher tMatcher = tPattern.matcher(tString);
      tbool = tMatcher.matches();
    }
    return tbool;
  }

  public static Boolean isMobile(String argString)
  {
    Boolean tbool = false;
    String tString = argString;
    if (!cls.isEmpty(tString))
    {
      Pattern tPattern = Pattern.compile("^1\\d{10}$");
      Matcher tMatcher = tPattern.matcher(tString);
      tbool = tMatcher.matches();
    }
    return tbool;
  }

  public static Boolean isNatural(String argString)
  {
    Boolean tbool = false;
    String tString = argString;
    if (!cls.isEmpty(tString))
    {
      Pattern tPattern = Pattern.compile("^[A-Za-z0-9]+$");
      Matcher tMatcher = tPattern.matcher(tString);
      tbool = tMatcher.matches();
    }
    return tbool;
  }

  public static Boolean isUsername(String argString)
  {
    Boolean tbool = false;
    String tString = argString;
    if (!cls.isEmpty(tString))
    {
      Pattern tPattern = Pattern.compile("^[\\u4e00-\\u9fa5_a-zA-Z0-9]+$");
      Matcher tMatcher = tPattern.matcher(tString);
      tbool = tMatcher.matches();
    }
    return tbool;
  }

  public static Boolean isZip(String argString)
  {
    Boolean tbool = false;
    String tString = argString;
    if (!cls.isEmpty(tString))
    {
      Pattern tPattern = Pattern.compile("^[0-9]\\d{5}$");
      Matcher tMatcher = tPattern.matcher(tString);
      tbool = tMatcher.matches();
    }
    return tbool;
  }
}